package cn.iocoder.yudao.module.member.dal.mysql.leaveword;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.member.dal.dataobject.leaveword.LeaveWordDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.member.controller.admin.leaveword.vo.*;

/**
 * 用户留言 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface LeaveWordMapper extends BaseMapperX<LeaveWordDO> {

    default PageResult<LeaveWordDO> selectPage(LeaveWordPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<LeaveWordDO>()
                .eqIfPresent(LeaveWordDO::getUserId, reqVO.getUserId())
                .likeIfPresent(LeaveWordDO::getName, reqVO.getName())
                .eqIfPresent(LeaveWordDO::getPhone, reqVO.getPhone())
                .eqIfPresent(LeaveWordDO::getMessage, reqVO.getMessage())
                .betweenIfPresent(LeaveWordDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(LeaveWordDO::getId));
    }

}